package fuse.LaCollaFS;

import java.util.ArrayList;

import junit.framework.TestCase;

public class testOperacions extends TestCase {
	private static Operacions o;

	public void testOperacions() {
		o = new Operacions();
	}

	public void testAfegirOperacio() {

		int id = 1;
		String path = "/";
		String member = "jomateix";
		String operacio = "CanviarStat";
		o.AfegirOperacio(2, path, "un altre", "hoolaaa");	
		o.AfegirOperacio(id, path, member, operacio);
	
		ArrayList<ArrayList<Comparable>> p = o.BuscarperPath(path);
		System.out.println(p.size());
		ArrayList<Comparable> v = p.get(p.size()-1);
		
		assertEquals(path, v.get(0));
		assertEquals(operacio, v.get(1));
		assertEquals(member, v.get(3));
		assertEquals(id, v.get(2));
		
		
	}
	
	public void testBuscarperPath(){}
	
	public void testBuscarperId(){}
	
	public void testTreureOperacio(){
	
		//per id
		
		int id = 1;
		String path = "/";
		String member = "jomateix";
		String operacio = "CanviarStat";
		o.AfegirOperacio(2, path, "un altre", "hoolaaa");	
		o.AfegirOperacio(id, path, member, operacio);
		
		assertEquals(0, o.TreureOperacio(1));
		assertEquals(-1, o.TreureOperacio(1));
		assertEquals(0, o.TreureOperacio(2));
		assertEquals(-1, o.TreureOperacio(4));
	//	assertEquals(-1, o.TreureOperacio(path));
		
		//per path
	
		
	}

}
